Background workers - #83
Merged
olivhoenen merged 45 commits intoJul 31, 2026
Merged
Conversation
Yannicked
force-pushed
the
feature/celery-tasks
branch
from
May 28, 2026 08:19
06bf048 to
68938a1
Compare
Merged
Yannicked
marked this pull request as ready for review
June 24, 2026 11:30
Yannicked
requested review from
SimonPinches,
maarten-ic,
olivhoenen and
prasad-sawantdesai
as code owners
June 24, 2026 11:30
This was
linked to
issues
Jul 1, 2026
Contributor
|
Please fix conflicts @Yannicked |
SimonPinches
requested changes
Jul 20, 2026
SimonPinches
left a comment
Contributor
There was a problem hiding this comment.
A few comments:
- I think you need to make
celeryaserverdependency inpyproject.toml(or guard the import ofcelery) since otherwisepip install imas-simdb[server]will produce a server that crashes on import. - If the broker is down when
apply_async()is called (the row is already committed as QUEUED), or a worker dies mid-COPYING (tasks are notacks_late, so the message is gone), the simulation will get stuck in a non-terminal state forever, anddelete_simulationwill return 409. The only recovery would seem to be manual DB surgery so we should probably add either an adminforce-deletecapability or a staleness timeout. - The watcher/notification behaviour is changed. Now
body.add_watcheris ignored and thesend_email_tasknever used - is this deliberate?
Collaborator
Author
Done!
Added the force-delete feature you suggested. On top of that: more graceful error handling (a failed apply_async() now marks the simulation COPY_FAILED and returns 503 instead of leaving it stuck), a cleanup task that marks copy/validation jobs stuck in a non-terminal state as failed, and a timeout on the tasks themselves. The task timeout defaults to 1h, for very datasets we might want to want to raise this
Fixed! |
olivhoenen
approved these changes
Jul 31, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces simulation ingestion via Celery background workers.
When simulations are uploaded through the new v1.3 API endpoint, file copying and status tracking are now handled by Celery tasks (copy_files_task chained with complete_ingestion_task) rather than blocking the HTTP request.
The ingestion pipeline tracks status though the following: QUEUED → COPYING → COPIED → VALIDATING → VALIDATED → COMPLETED, with failure variants.